package cn.iocoder.yudao.module.jifenyuan.controller.app.walletlog;

import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;

import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;

import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;

import cn.iocoder.yudao.module.jifenyuan.controller.app.walletlog.vo.*;
import cn.iocoder.yudao.module.jifenyuan.dal.dataobject.walletlog.WalletLogDO;
import cn.iocoder.yudao.module.jifenyuan.convert.walletlog.WalletLogConvert;
import cn.iocoder.yudao.module.jifenyuan.service.walletlog.WalletLogService;

@Tag(name = "用户 APP - 记分员 钱包记录")
@RestController
@RequestMapping("/jifenyuan/wallet-log")
@Validated
public class AppWalletLogController {

    @Resource
    private WalletLogService walletLogService;

//    @PostMapping("/create")
//    @Operation(summary = "创建记分员 钱包记录")
//
//    public CommonResult<Long> createWalletLog(@Valid @RequestBody AppWalletLogCreateReqVO createReqVO) {
//        return success(walletLogService.createWalletLog(createReqVO));
//    }
//
//    @PutMapping("/update")
//    @Operation(summary = "更新记分员 钱包记录")
//
//    public CommonResult<Boolean> updateWalletLog(@Valid @RequestBody AppWalletLogUpdateReqVO updateReqVO) {
//        walletLogService.updateWalletLog(updateReqVO);
//        return success(true);
//    }
//
//    @DeleteMapping("/delete")
//    @Operation(summary = "删除记分员 钱包记录")
//    @Parameter(name = "id", description = "编号", required = true)
//
//    public CommonResult<Boolean> deleteWalletLog(@RequestParam("id") Long id) {
//        walletLogService.deleteWalletLog(id);
//        return success(true);
//    }
//
//    @GetMapping("/get")
//    @Operation(summary = "获得记分员 钱包记录")
//    @Parameter(name = "id", description = "编号", required = true, example = "1024")
//
//    public CommonResult<AppWalletLogRespVO> getWalletLog(@RequestParam("id") Long id) {
//        WalletLogDO walletLog = walletLogService.getWalletLog(id);
//        return success(WalletLogConvert.INSTANCE.convert(walletLog));
//    }
//
//    @GetMapping("/list")
//    @Operation(summary = "获得记分员 钱包记录列表")
//    @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
//
//    public CommonResult<List<AppWalletLogRespVO>> getWalletLogList(@RequestParam("ids") Collection<Long> ids) {
//        List<WalletLogDO> list = walletLogService.getWalletLogList(ids);
//        return success(WalletLogConvert.INSTANCE.convertList(list));
//    }
//
    @GetMapping("/page")
    @Operation(summary = "获得记分员 钱包记录分页")
    @PreAuthenticated
    public CommonResult<PageResult<AppWalletLogRespVO>> getWalletLogPage(@Valid AppWalletLogPageReqVO pageVO) {
        PageResult<WalletLogDO> pageResult = walletLogService.getWalletLogPage(pageVO);
        return success(WalletLogConvert.INSTANCE.convertPage(pageResult));
    }
//
//    @GetMapping("/export-excel")
//    @Operation(summary = "导出记分员 钱包记录 Excel")
//
//    @OperateLog(type = EXPORT)
//    public void exportWalletLogExcel(@Valid AppWalletLogExportReqVO exportReqVO,
//              HttpServletResponse response) throws IOException {
//        List<WalletLogDO> list = walletLogService.getWalletLogList(exportReqVO);
//        // 导出 Excel
//        List<AppWalletLogExcelVO> datas = WalletLogConvert.INSTANCE.convertList02(list);
//        ExcelUtils.write(response, "记分员 钱包记录.xls", "数据", AppWalletLogExcelVO.class, datas);
//    }

}
